package com.example.riskmanage.controller;

import com.example.riskmanage.bean.Admin;
import com.example.riskmanage.service.AdminManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class AdminController {


    @Autowired
    AdminManager adminManager;


    @RequestMapping("/admin")
    public String admin(Integer id) {

        String RESPONE = adminManager.getAdminService(id);
        return RESPONE;

    }

    @RequestMapping("/addadmin")
    public String add(@RequestBody Admin admin) {

        String flag = adminManager.addAdminService(admin);

        return flag;

    }

    @RequestMapping("/deleteadmin")
    public String delete(Integer id) {
        String flag = adminManager.deleteAdminService(id);
        return flag;
    }

    @RequestMapping("/getupdateadmin")
    public String edit(Integer id) {
        String RESPONE = adminManager.geteditService(id);
        return RESPONE;
    }

    @RequestMapping("/editadmin")
    public String edits(Admin admin) {
        String flag1 = adminManager.editAdminService(admin);
        return flag1;
    }
}
